#pragma once
#include"UIManager.h"
#include"UIControl.h"
#include"UILabel.h"

#define WIN32_LEAN_AND_MEAN
#include<Windows.h>

 class HRTimer
{
 private:
     LARGE_INTEGER start;
     LARGE_INTEGER stop;
     LARGE_INTEGER frequency;
     //double LIToSecs( LARGE_INTEGER & L) ;
 public:
     HRTimer() ;
     void Start( ) ;
     void Stop( ) ;
     __int64 ElapsedTime() ;
 };
 //double HRTimer::LIToSecs( LARGE_INTEGER & L) {
 //    return ((double)L.QuadPart /(double)frequency.QuadPart);
 //}
 HRTimer::HRTimer(){
     start.QuadPart=0;
     stop.QuadPart=0; 
     QueryPerformanceFrequency( &frequency ) ;
 }
 void HRTimer::Start( ) {
	 start.QuadPart=0;
     stop.QuadPart=0;
     QueryPerformanceCounter(&start) ;
 }
 void HRTimer::Stop( ) {
     start.QuadPart=0;
     stop.QuadPart=0;
 }
 __int64 HRTimer::ElapsedTime() {
     LARGE_INTEGER time;
	 QueryPerformanceCounter(&time);
	 return time.QuadPart - start.QuadPart;
 }
 class Timer
 {
 public:
	 Timer();
	 static void Start();
	 static __int64 SecondsToCycles(float seconds);
	 static double CyclesToSeconds(__int64 cycles_);
	 void Update(__int64 realTime);
	 void Reset();
	 __int64 GetTimeCycles()const{return cycles.QuadPart;}
 private:
	 static LARGE_INTEGER cyclesPerSecond;
	 LARGE_INTEGER cycles;
 };
 Timer::Timer()
 {
	 cycles.QuadPart = 0;
 }
LARGE_INTEGER Timer::cyclesPerSecond;
 void Timer::Start()
 {
	 QueryPerformanceFrequency( &cyclesPerSecond ) ;
 }
 void Timer::Update(__int64 realTime)
 {
	 cycles.QuadPart += realTime;
 }
 __int64 Timer::SecondsToCycles(float seconds)
 {
     return seconds * cyclesPerSecond.QuadPart;
 }
 double Timer::CyclesToSeconds(__int64 cycles_)
 {
	 return (double)cycles_ / cyclesPerSecond.QuadPart;
 }
 void Timer::Reset()
 {
	 cycles.QuadPart = 0;
 }

